<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-tCompanyDept-add">
        
        	<div class="form-group">	
        		<input id="treeId" name="parentId" type="hidden" th:value="${dept.id}"   />
				<label class="col-sm-3 control-label">上级部门</label>
				<div class="col-sm-8">
					<input id="treeName" name="parentId" onclick="selectDeptTree()" readonly="true" class="form-control" type="text" th:value="${dept.deptName}">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">部门名称：</label>
				<div class="col-sm-8">
					<input id="deptName" name="deptName" class="form-control" type="text">
				</div>
			</div>
			
			<div class="form-group">	
				<label class="col-sm-3 control-label">部门顺序：</label>
				<div class="col-sm-8">
					<input id="orderNum" name="orderNum" class="form-control" type="text">
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "system/tCompanyDept"
		$("#form-tCompanyDept-add").validate({
			rules:{
				xxxx:{
					required:true,
				},
			}
		});
		
		/*部门管理-新增-选择父部门树*/
		function selectDeptTree() {
			var options = {
				title: '部门选择',
				width: "380",
				url: prefix + "/selectDeptTree/",
				callBack: doSubmit
			};
			$.modal.openOptions(options);
		}
		
		function doSubmit(index, layero){
			var body = layer.getChildFrame('body', index);
   			$("#treeId").val(body.find('#treeId').val());
   			$("#treeName").val(body.find('#treeName').val());
   			layer.close(index);
		}
		
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/add", $('#form-tCompanyDept-add').serialize());
	        }
	    }
	</script>
</body>
</html>
